<?php
if (!defined('BASEPATH'))
    exit('No direct script access allowed');
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
?>
<script type="text/javascript" language="javascript">
    var datasiswaStore = createStore(false, 'mdatasiswaStore',
    ['nis','nama','ayah','ibu','alamat','telepon','seluler','tempat_lahir','tgl_lahir','th_masuk','th_alumni','jenis_kelamin','kd_kelas','tinggi','berat','tgl_entri','id_user'],
    '<?php echo base_url(); ?>' + 'datasiswa/get_rows');
    
    var comboKelasStore = createStore(false, 'mcomboKelasStore', ['kd_kelas','keterangan'], '<?php echo base_url(); ?>' + 'masterkelas/get_rows_combo');
    
    //===================
    Ext.define('Formsiswa', {
        extend          : 'Ext.form.Panel',
        alias           : 'widget.siswaForm',
        id              : 'Formsiswa_id',
        requires        : [
            'Ext.form.Field'
        ],
        defaultType     : 'textfield',
        defaults        : {
            allowBlank: false,
            labelWidth: 130,
            labelAlign: 'right'
        },
        monitorValid: true,
        url: '<?php echo base_url(); ?>' + 'datasiswa/update_rows',
        buttonAlign     : 'center',
        padding         : 5,
        style           : 'background-color: #fff;',
        border          : false,
        initComponent   : function(){
            this.items = [
                //                    cbjenis,         
                {
                    xtype: 'fieldset',
                    title: 'Data Pribadi',
                    defaultType: 'textfield',
                    layout: 'anchor',
                    defaults: {
                        anchor: '100%',
                        labelAlign: 'right',
                        allowBlank: false,
                        labelWidth: 135
                    },
                    items: [
                        {
                            xtype: 'fieldcontainer',
                            fieldLabel: 'NIS/Nama Siswa',
                            labelWidth: 130,
                            layout: 'hbox',                    
                            defaultType: 'textfield',                    
                            //                    margin: '0 0 5 0',
                            defaults: {
                                labelWidth: 80,
                                labelAlign: 'right'
                                ,hideLabel: 'true'
                            },
                            tooltip: 'Field tidak boleh kosong',
                            afterLabelTextTpl: required_css,
                            items: [{
                                    name: 'nis',
                                    //                        anchor:'90%',
                                    id: 'siswa_nis',
                                    tooltip: 'Field tidak boleh kosong',
                                    afterLabelTextTpl: required_css,
                                    fieldLabel: 'Nis',
                                    emptyText: 'Nomor Induk Siswa',
                                    maxLength:20,
                                    width:120,
                                    //                        flex: 1,
                                    allowBlank:false

                                }, {
                                    name: 'nama',
                                    id: 'siswa_nama',
                                    fieldLabel: 'Nama Siswa',
                                    maxLength:50,
                                    flex: 2,
                                    labelWidth: 80,
                                    //                        width:200,
                                    margins: '0 0 0 5',
                                    emptyText: 'Nama Siswa',
                                    allowBlank: false,
                                    tooltip: 'Field tidak boleh kosong',
                                    afterLabelTextTpl: required_css
                                }]
                        }                    
                        ,{
                            xtype: 'fieldcontainer',
                            fieldLabel: 'Tempat/Tanggal Lahir',
                            layout: 'hbox',                    
                            defaultType: 'textfield',
                            labelWidth: 130,
                            //                    margin: '0 0 5 0',
                            defaults: {
                                labelWidth: 80,
                                labelAlign: 'right',
                                hideLabel: 'true'
                            },
                            tooltip: 'Field tidak boleh kosong',
                            afterLabelTextTpl: required_css,
                            items: [{
                                    name: 'tempat_lahir',
                                    //                        anchor:'90%',
                                    id: 'siswa_tempat_lahir',
                                    tooltip: 'Field tidak boleh kosong',
                                    afterLabelTextTpl: required_css,
                                    fieldLabel: 'Tempat Lahir',
                                    emptyText: 'Tempat Lahir',
                                    fieldStyle: 'text-transform:uppercase;',
                                    maxLength:20,
                                    width:100,
                                    flex: 1,
                                    allowBlank:false,
                                    listeners: {
                                        change: function(field, newValue, oldValue) {
                                            field.setValue(newValue.toUpperCase());
                                        }
                                    }

                                }, {
                                    xtype:'datefield',
                                    name: 'tgl_lahir',
                                    id: 'siswa_tgl_lahir',
                                    fieldLabel: 'Tanggal lahir',                        
                                    //                        flex: 2,
                                    width:200,
                                    margins: '0 0 0 5',
                                    emptyText: 'Tanggal lahir',
                                    format:'d F Y',
                                    allowBlank: false,
                                    tooltip: 'Field tidak boleh kosong',
                                    afterLabelTextTpl: required_css
                                }]
                        }
                        //                        ,new Ext.form.RadioGroup({
                        //                        xtype: 'radiogroup',
                        //                            fieldLabel: 'Jenis Kelamin',
                        //                            id:'siswa_jenis_kelamin',
                        //                            items: [
                        //                                {boxLabel: 'Laki-laki', name: 'jenis_kelamin', inputValue: 'L', checked: true},
                        //                                {boxLabel: 'Perempuan', name: 'jenis_kelamin', inputValue: 'P'}
                        //                            ]
                        //                        }),
                        ,{
                            xtype: 'fieldcontainer',
                            fieldLabel: 'Tinggi/Berat Badan',
                            layout: 'hbox',                    
                            defaultType: 'textfield',
                            labelWidth: 130,
                            //                    margin: '0 0 5 0',
                            defaults: {
                                labelWidth: 80,
                                labelAlign: 'right',
                                hideLabel: 'true'
                            },
                            tooltip: 'Field tidak boleh kosong',
                            afterLabelTextTpl: required_css,
                            items: [
                                {
                                    xtype: 'numberfield',
                                    name: 'tinggi',
                                    id: 'siswa_tinggi',
                                    fieldLabel: 'Tinggi Badan',
                                    width:80,
                                    //                                    flex: 1,                                    
                                    //                                    margins: '0 0 0 5',
                                    emptyText: 'Tinggi Badan',
                                    hideTrigger: true,
                                    keyNavEnabled: false,
                                    mouseWheelEnabled: false,
                                    minValue:0,
                                    allowBlank: false
                                },{
                                    xtype: 'numberfield',
                                    name: 'berat',
                                    id: 'siswa_berat',
                                    fieldLabel: 'Berat Badan',
                                    width:80,
                                    //                                    flex: 1,                                    
                                    margins: '0 0 0 5',
                                    emptyText: 'Berat Badan',
                                    hideTrigger: true,
                                    keyNavEnabled: false,
                                    mouseWheelEnabled: false,
                                    minValue:0,
                                    allowBlank: false
                                }
                                ,{
                                    xtype: 'radiogroup',
                                    cls: 'x-check-group-alt',
                                    hideLabel:false,
                                    margins: '0 0 0 10',
                                    border: 1,
                                    flex:1,
                                    allowBlank: false,
                                    fieldLabel: 'Jenis Kelamin',
                                    id:'siswa_jenis_kelamin',
                                    columns: [80, 80],
                                    items: [
                                        {boxLabel: 'Laki-laki', name: 'jenis_kelamin', inputValue: 'L', checked: true},
                                        {boxLabel: 'Perempuan', name: 'jenis_kelamin', inputValue: 'P'}
                                    ]
                                }
                            ]
                        }
                        , {
                            name: 'alamat',
                            id: 'siswa_alamat',
                            fieldLabel: 'Alamat Siswa',
                            maxLength:100,
                            //                        flex: 2,
                            labelWidth: 130,
                            //                        width:200,
                            //                        margins: '0 0 0 5',
                            emptyText: 'Alamat Siswa',
                            allowBlank: false,
                            tooltip: 'Field tidak boleh kosong',
                            afterLabelTextTpl: required_css
                        }
                        ,{
                            xtype: 'fieldcontainer',
                            fieldLabel: 'Telepon/Seluler',
                            labelWidth: 130,
                            layout: 'hbox',                    
                            defaultType: 'textfield',                    
                            margin: '0 0 10 0',
                            defaults: {
                                labelWidth: 80,
                                labelAlign: 'right'
                                ,hideLabel: 'true'
                            }
                            ,
                            //                    tooltip: 'Field tidak boleh kosong',
                            //                        afterLabelTextTpl: required_css,
                            items: [{
                                    name: 'telepon',
                                    //                        anchor:'90%',
                                    id: 'siswa_telepon',
                                    //                        tooltip: 'Field tidak boleh kosong',
                                    //                        afterLabelTextTpl: required_css,
                                    fieldLabel: 'Telepon',
                                    emptyText: 'Telepon',
                                    maxLength:30,
                                    //                        width:120,
                                    flex: 1,
                                    allowBlank:true

                                }, {
                                    name: 'seluler',
                                    id: 'siswa_seluler',
                                    fieldLabel: 'Seluler',
                                    maxLength:30,
                                    flex: 1,
                                    labelWidth: 80,
                                    //                        width:200,
                                    margins: '0 0 0 5',
                                    emptyText: 'Seluler',
                                    allowBlank: true
                                    //                        ,tooltip: 'Field tidak boleh kosong',
                                    //                        afterLabelTextTpl: required_css
                                }]
                        }
                    ]
                },
                {
                    xtype: 'fieldset',
                    title: 'Orang Tua',
                    defaultType: 'textfield',
                    layout: 'anchor',
                    defaults: {
                        anchor: '100%',
                        labelAlign: 'right',
                        allowBlank: false,
                        labelWidth: 135
                    },
                    items: [{
                            xtype: 'container',
                            //                    fieldLabel: 'Telepon/Seluler',
                            //                    labelWidth: 130,
                            layout: 'hbox',                    
                            defaultType: 'textfield',                    
                            margin: '0 0 10 0',
                            defaults: {
                                labelWidth: 80,
                                labelAlign: 'right'
                                //                        ,hideLabel: 'true'
                                ,tooltip: 'Field tidak boleh kosong',
                                afterLabelTextTpl: required_css
                            }
                            ,
                            //                    tooltip: 'Field tidak boleh kosong',
                            //                        afterLabelTextTpl: required_css,
                            items: [{
                                    name: 'ayah',
                                    //                        anchor:'90%',
                                    id: 'siswa_ayah',
                                    //                        tooltip: 'Field tidak boleh kosong',
                                    //                        afterLabelTextTpl: required_css,
                                    fieldLabel: 'Nama Ayah',
                                    emptyText: 'Nama Ayah',
                                    maxLength:50,
                                    //                        width:120,
                                    flex: 1,
                                    allowBlank:false

                                }, {
                                    name: 'ibu',
                                    id: 'siswa_ibu',
                                    fieldLabel: 'Nama Ibu',
                                    maxLength:50,
                                    flex: 1,
                                    //                        labelWidth: 80,
                                    //                        width:200,
                                    margins: '0 0 0 5',
                                    emptyText: 'Nama Ibu',
                                    allowBlank: false
                                    //                        ,tooltip: 'Field tidak boleh kosong',
                                    //                        afterLabelTextTpl: required_css
                                }]
                        }]
                },
                {
                    xtype: 'fieldset',
                    title: 'Kesiswaan',
                    defaultType: 'textfield',
                    layout: 'anchor',
                    defaults: {
                        anchor: '100%',
                        labelAlign: 'right',
                        allowBlank: false,
                        labelWidth: 135
                    },
                    items: [{
                            xtype: 'container',
                            layout: 'hbox',                    
                            defaultType: 'textfield',                    
                            margin: '0 0 10 0',
                            defaults: {
                                labelWidth: 100,
                                labelAlign: 'right'
                                
                            }
                            ,
                            items: [
                                {
                                    xtype: 'combo',                        
                                    name:'kd_kelas',
                                    tooltip: 'Field tidak boleh kosong',
                                    afterLabelTextTpl: required_css,
                                    fieldLabel: 'Kelas',                        
                                    id: 'siswa_kd_kelas',
                                    mode:'local',
                                    store: comboKelasStore,
                                    valueField: 'kd_kelas',
                                    displayField: 'keterangan',
                                    typeAhead: true,
                                    triggerAction: 'all',                    
                                    allowBlank: false,
                                    editable: false,
                                    //                    anchor: '90%',
                                    flex: 1,
                                    hiddenName: 'kd_kelas'
                                    ,
                                    margins: '0 0 0 5',
                                    emptyText: 'Kelas'              
                                },
                                {
                                    xtype: 'numberfield',
                                    name: 'th_masuk',
                                    id: 'siswa_th_masuk',
                                    fieldLabel: 'Tahun Masuk',
                                    flex: 1,
                                    value: new Date().getFullYear(),
                                    maxValue: new Date().getFullYear(),
                                    minValue:'1900',
                                    margins: '0 0 0 5',
                                    emptyText: 'Tahun Masuk',
                                    allowBlank: false
                                    ,tooltip: 'Field tidak boleh kosong',
                                    afterLabelTextTpl: required_css
                                }
                                ,{
                                    xtype: 'numberfield',
                                    name: 'th_alumni',
                                    id: 'siswa_th_alumni',
                                    fieldLabel: 'Tahun Alumni',
                                    flex: 1,
                                    value: new Date().getFullYear(),
                                    minValue:'1900',
                                    //                                    value: new Date().getFullYear(),
                                    maxValue: new Date().getFullYear(),
                                    margins: '0 0 0 5',
                                    emptyText: 'Tahun Alumni'
                                    //                                    allowBlank: false
                                }
                    
                    
                            ]}
                    ]}
                
            ];
            this.buttons = [
                {
                    text: 'Simpan',                    
                    itemId: 'simpan',
                    id:'btn_siswa_simpan',
                    iconCls: 'save',
                    formBind: true,
                    scope: this,
                    handler: this.submit
                },
                {
                    text: 'Batal',
                    action: 'cancel',
                    itemId: 'batal',
                    iconCls: 'cancel',
                    handler: function(){
                        this.up('window').close();
                    }
                }
            ];
            this.callParent(arguments);
        },
        submit: function(){
            var parcmd=Ext.getCmp('btn_siswa_simpan').getText();
            if(parcmd === 'Simpan'){
                parcmd='insert';
            }else if(parcmd === 'Edit'){
                parcmd='update';
            }
            var mtgl_lahir=Ext.Date.format(Ext.getCmp('siswa_tgl_lahir').getValue(), 'Y-m-d');
            var mth_alumni=Ext.getCmp('siswa_th_alumni').getValue();
            //            console.log(mtgl_lahir);
            //            console.log(mth_alumni);
            
            //            var mtgl_lahir=Ext.getCmp('siswa_tgl_lahir').getValue();
                    
            Ext.getCmp('Formsiswa_id').getForm().submit({
                url: this.url,
                scope: this,               
                //                success: this.onSuccess,
                //                failure: this.onFailure,
                params: {
                    cmd: parcmd,
                    mtgl_lahir:mtgl_lahir,
                    mth_alumni:mth_alumni
                },
                waitMsg: 'Saving Data...',
                success: function(form, action) {
                    //                    console.log(action);
                    set_message(0,action.result.msg);
                    //                    Ext.Msg.alert('Success', action.result.msg);
                    Ext.getCmp('griddatasiswa').store.reload(); 
                    Ext.getCmp('Formsiswa_id').getForm().reset();
                    Ext.getCmp('Windowsiswa_id').close();
                },
                failure: function(form, action) {
                    if(action.result.msg=='Session Expired') {
                        session_expired(action.result.msg);
                    }else{
                        set_message(1, action.result.msg);
                    }
                                            
                    
                }
            });
        } // eo function submit        
        ,
        showError: function(msg, title){
            title = title || 'Error';
            Ext.Msg.show({
                title: title,
                msg: msg,
                modal: true,
                icon: Ext.Msg.ERROR,
                buttons: Ext.Msg.OK,
                fn: function(btn){
                    if (btn == 'ok' && msg == 'Session Expired') {
                        window.location = '<?= site_url("auth/login") ?>';
                    }
                }
            });
        }
    });

    Ext.define('Windowsiswa', {
        extend          : 'Ext.window.Window',
        title           : 'Form Edit Siswa',
        width           : 700,
        height          : 450,
        layout          : 'fit',
        autoShow        : true,
        modal           : true,
        alias           : 'widget.siswaEdit',
        id              : 'Windowsiswa_id',
        initComponent   : function(){
            this.items = [
                Ext.widget('siswaForm')
            ];
            this.callParent(arguments);
        }

    });
    //===================
    Ext.define('MyTabDataSiswa', {
        extend: 'Ext.container.Container',
        xtype: 'TabDataSiswa',
        alias: 'widget.TabDataSiswa',
        title: 'Data Siswa',
        id: 'tab8',
        closable: true,        
        layout: 'border',
        items: [
            {
                xtype: 'panel',
                autoShow: true,
                id: 'paneldatasiswa',            
                region: 'center',
                margins: '5 5 5 5',
                layout: 'fit',
                items:[
                    {
                        xtype:'grid',
                        id:'griddatasiswa',
                        stateful:true,
                        stateId:'stateGriddatasiswa',
                        store: datasiswaStore,//Ext.data.StoreManager.lookup('mMasterAccountStore'),
                        stripeRows: true,
                        loadMask: true,
                        //                        sm:sm_masteraccount,
                        columns:[
                            {
                                header: 'Edit/Delete',
                                menuDisabled: true,
                                sortable: false,
                                xtype: 'actioncolumn',
                                width: 70,
                                items: [
                                    {
                                        iconCls: 'icon-edit-record',
                                        tooltip: 'Edit Row',
                                        handler: function(grid, rowIndex, colIndex) {
                                            var rec = grid.getStore().getAt(rowIndex);
                                            var winsiswa=Ext.create('Windowsiswa');
                                            winsiswa.setTitle('Edit Form');
                                            Ext.getCmp('btn_siswa_simpan').setText('Edit');
                                            Ext.getCmp('btn_siswa_simpan').setIconCls('icon-edit-record');
                                            Ext.getCmp('siswa_nis').setReadOnly(true);
                                            Ext.getCmp('siswa_nis').setFieldStyle('readonly-input');
                                            
                                            Ext.getCmp('siswa_nis').setValue(rec.get('nis'));
                                            Ext.getCmp('siswa_nama').setValue(rec.get('nama'));
                                            Ext.getCmp('siswa_tempat_lahir').setValue(rec.get('tempat_lahir'));
                                            Ext.getCmp('siswa_tgl_lahir').setValue(rec.get('tgl_lahir'));
                                            Ext.getCmp('siswa_jenis_kelamin').setValue({'jenis_kelamin':rec.get('jenis_kelamin')});
                                            Ext.getCmp('siswa_alamat').setValue(rec.get('alamat'));
                                            Ext.getCmp('siswa_telepon').setValue(rec.get('telepon'));
                                            Ext.getCmp('siswa_seluler').setValue(rec.get('seluler'));
                                            Ext.getCmp('siswa_ayah').setValue(rec.get('ayah'));
                                            Ext.getCmp('siswa_ibu').setValue(rec.get('ibu'));
                                            Ext.getCmp('siswa_kd_kelas').setValue(rec.get('kd_kelas'));
                                            Ext.getCmp('siswa_th_masuk').setValue(rec.get('th_masuk'));
                                            Ext.getCmp('siswa_th_alumni').setValue(rec.get('th_alumni'));
                                            Ext.getCmp('siswa_tinggi').setValue(rec.get('tinggi'));
                                            Ext.getCmp('siswa_berat').setValue(rec.get('berat'));
                                            
                                            
                                            winsiswa.show();
                                            //                                            Ext.Msg.alert('Edit', 'Edit ' + rec.get('rekening'));
                                        }
                                    },{
                                        getClass: function(v, meta, rec) {
                                            return 'icon-delete';
                                        },
                                        getTip: function(v, meta, rec) {
                                            return 'Delete Plant';
                                        },
                                        handler: function(grid, rowIndex, colIndex) {
                                            var rec = grid.getStore().getAt(rowIndex);
                                            console.log(rec.data);
                                            //                                            Ext.Msg.alert('Delete', 'Delete ' + rec.get('rekening'));
                                            Ext.Msg.show({
                                                title: 'Confirm',
                                                msg: 'Are you sure delete selected row ?',
                                                buttons: Ext.Msg.YESNO,
                                                icon: Ext.Msg.QUESTION,
                                                fn: function(btn){
                                                    if (btn == 'yes') {
                                                                
                                                        var data = '';
                                                        data = Ext.JSON.encode(rec.data);
                                                                    
                                                        Ext.Ajax.request({                                                            
                                                            url: '<?php echo base_url(); ?>' +'datasiswa/delete_row',
                                                            method: 'POST',
                                                            params: {
                                                                cmd: 'delete',
                                                                postdata: data
                                                            },
                                                            success: function(obj) {
                                                                var   resp = Ext.decode(obj.responseText);                                                                
                                                                if(resp.success==true){
                                                                    //                                                                    Ext.Msg.alert('info',resp.msg);
                                                                    set_message(0,resp.msg);
                                                                    Ext.getCmp('griddatasiswa').store.reload();                                                                                                                                     
                                                                }else{
                                                                    Ext.Msg.show({
                                                                        title: 'Error',
                                                                        msg: resp.msg,
                                                                        modal: true,
                                                                        icon: Ext.Msg.ERROR,
                                                                        buttons: Ext.Msg.OK,
                                                                        fn: function(btn){
                                                                            if (btn == 'ok' && resp.msg == 'Session Expired') {
                                                                                window.location = '<?= site_url("auth/login") ?>';
                                                                            }
                                                                        }
                                                                    });
                                                                }
                                                            },
                                                            failure: function(obj) {
                                                                var  resp = Ext.decode(obj.responseText);
                                                                set_message(0, resp.reason);
                                                                //                                                                Ext.Msg.alert('info',resp.reason);
                                                            }                                                            
                                                        });                 
                                                    } 
                                                }
                                            });
                                        }
                                    }
                                ]
                            }
                           
                            ,
                            {
                                header: "NIS",
                                dataIndex: 'nis',
                                sortable: true,
                                width: 100
                            }
                            ,{
                                header: "Nama Siswa",
                                dataIndex: 'nama',
                                sortable: true,
                                width: 120                                
                            }
                            ,{
                                header: "Nama Ayah",
                                dataIndex: 'ayah',
                                sortable: true,
                                width: 120                                
                            }
                            ,{
                                header: "Nama Ibu",
                                dataIndex: 'ibu',
                                sortable: true,
                                width: 120                                
                            }
                            ,{
                                header: "Alamat",
                                dataIndex: 'alamat',
                                sortable: true,
                                width: 150                                
                            }
                            ,{
                                header: "Telepon",
                                dataIndex: 'telepon',
                                sortable: true,
                                width: 100                                
                            }
                            ,{
                                header: "Seluler",
                                dataIndex: 'seluler',
                                sortable: true,
                                width: 100                                
                            }
                            ,{
                                header: "Tempat Lahir",
                                dataIndex: 'tempat_lahir',
                                sortable: true,
                                width: 120                                
                            }
                            ,{
                                header: "Tanggal Lahir",
                                dataIndex: 'tgl_lahir',
                                sortable: true,
                                width: 80                                
                            }
                            ,{
                                header: "Tahun Masuk",
                                dataIndex: 'th_masuk',
                                sortable: true,
                                width: 80,
                                align:'center'
                            }
                            ,{
                                header: "Tahun Alumni",
                                dataIndex: 'th_alumni',
                                sortable: true,
                                width: 80                                
                                ,align:'center'
                            }
                            ,{
                                header: "Jenis Kelamin",
                                dataIndex: 'jenis_kelamin',
                                sortable: true,
                                width: 80     
                                ,align:'center'
                            }
                            ,{
                                header: "Kelas",
                                dataIndex: 'kd_kelas',
                                sortable: true,
                                width: 50     
                                ,align:'center'
                            }
                            ,{
                                header: "Tinggi",
                                dataIndex: 'tinggi',
                                sortable: true,
                                width: 50  
                                ,align:'right'
                            }
                            ,{
                                header: "Berat",
                                dataIndex: 'berat',
                                sortable: true,
                                width: 50        
                                ,align:'right'
                            }
                            ,{
                                header: "Tanggal Entry",
                                dataIndex: 'tgl_entri',
                                sortable: true,
                                width: 100                                
                            }
                            ,{
                                header: "User Entry",
                                dataIndex: 'id_user',
                                sortable: true,
                                width: 120                                
                            }
                        
                        ]
                        ,tbar:{
                            xtype: 'toolbar',
                            padding:'2 0 2 5',
                            items: [
                                {
                                    xtype: 'button',
                                    text: 'Add',
                                    iconCls: 'icons-add',
                                    onClick: function()
                                    {
                                        var winsiswa=Ext.create('Windowsiswa');
                                        winsiswa.setTitle('Add Form');
                                        Ext.getCmp('btn_siswa_simpan').setText('Simpan');
                                        Ext.getCmp('btn_siswa_simpan').setIconCls('icons-add');
                                        //                                        setDefaultStoreProxy(KelompokAccountStore, urlKelompok);
                                        winsiswa.show();
                                    } 
                                },
                                '-',
                                {
                                    width: 300,
                                    //                                fieldLabel: 'Search',
                                    //                                labelWidth: 50,
                                    xtype: 'searchfield',
                                    store: datasiswaStore,
                                    emptyText: 'Quick Search...'
                                }
                            ]
                        }
                        ,bbar:{                        
                            xtype: 'pagingtoolbar',
                            store: datasiswaStore,pageSize: ENDPAGE,
                            displayInfo: true
                            //                    plugins: Ext.create('Ext.ux.SlidingPager', {})
                        }

                    }
                ]
            }
        ]
        ,
        listeners:{
            show:function(){
                var storegrid=Ext.getCmp('griddatasiswa').store;                
                storegrid.loadPage(1);
                comboKelasStore.load();
               
            }
        }
        , initComponent: function() {
            this.callParent(arguments);
        }
    });
</script>